package com.kevin.factory;

/**
 * 创建工厂类
 *
 * @author kevin
 * @date 2015-9-15 下午2:05:05
 */
public class CashFactory {

    public static CashSuper cashSuperAdapter(String type) {
        if (type == null) {
            throw new IllegalArgumentException("收费类型不能为空");
        }
        return switch (type) {
            case "满300返100" -> new CashReturn(300, 100);
            case "打8折" -> new CashRebate(0.8);
            default -> new CashNormal();
        };
    }
}
